
import * as _ from 'lodash'

/**
 * JSON或是基础类型数据'trim'方法;
*/

export const Trim = (params: string | Array<any> | Object) => {
  // 数据直接是字符串
  if (_.isString(params)) {
    params = _.trim(params);
  } else if (_.isArray(params)) {
    params.forEach((param: any) => {
      param = _.trim(param);
    });
  } else if (_.isObject(params)) {
    for (let key in params) {
      params[key] = _.trim(params[key]);
    }
  }
  return params;
};